package net.huashitong.Indicators.dao;

import com.sirdc.modules.core.dao.GenericQuery;
import com.sirdc.modules.core.dao.StringDao;
import net.huashitong.Indicators.entity.MenusAuth;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public class MenusAuthDao extends StringDao<MenusAuth> {

    //根据userId获取菜单权限
    public MenusAuth getByUserId(String userId){

        GenericQuery query  = createQuery("obj");
        query.append(" and obj.userId=:userId").setParam("userId",userId);
        List<MenusAuth> list = query.listResult();
        if(list.size()==0||list==null){
            return null;
        }else{
            return query.firstResult();
        }
    }
}
